<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>商品管理</title>
    <script src="js/app.js"></script>
    <script src="js/holder.js"></script>
    <script src="js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="css/bootstrap.css">

</head>
<body>
<div th:insert="admin/navigate::nav"></div>
<div class="panel panel-default" style="margin-top: -20px;">
    <div class="comtent_1">


        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <a href="" class="list-group-item active"  type="button" data-toggle="modal" data-target="#login-modal">
                            <center><strong>商品管理</strong></center>
                        </a>
                    </div>
                    <div class="panel-body">
                        <table class="table table-striped table-hover table-responsive">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>名称</th>
                                <th>单价</th>
                                <th>数量</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="goodManage :${goodManages}">
                                <th th:text="${goodManage.goodsNums}">1001</th>
                                <th th:text="${goodManage.goodsName}">泡面</th>
                                <th th:text="${goodManage.goodsPrice}">4.5</th>
                                <th th:text="${goodManage.goodsNumber}">20</th>
                                <!--                             判断：当数量为0时，用户页面不显示
                                                                <th th:if="${goodManage.goodsNumber}!=0">20</th>-->
                                <td>
                                    <form action="/getGoodId" method="post">
                                        <button  type="submit" class="btn btn-success" th:value="${goodManage.goodsId}" name="goodNum">修改</button>
                                    </form>
                                    <form action="/delectGood" method="post">
                                        <button type="submit" class="btn btn-danger" th:value="${goodManage.goodsId}" name="id">删除</button>
                                    </form>
                                </td>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<div class="modal fade" id="login-modal" tabindex="-1" data-remote="goods_modefy.html">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">&times;</button>
                <h4>商品信息添加</h4>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xs-6 col-sm-6 col-md-6 col-lg-offset-2 col-xs-offset-2 col-lg-offset-2">
                        <div class="modal-body">

                            <form action="/addGood" method="post">
                                <div class="form-group">
                                    <label >编号</label>
                                    <input type="number" class="form-control" id="goods_id" placeholder="输入编号"  name="goodsNums">
                                </div>
                                <div class="form-group">
                                    <label for="name">名称</label>
                                    <input type="text" class="form-control" id="name" placeholder="输入名称" name="goodsName">
                                </div>
                                                            <div class="form-group">
                                                                <label for="price">单价</label>
                                                                <input type="number" class="form-control" id="price" placeholder="输入单价" name="goodsPrice">
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="number">数量</label>
                                                                <input type="number" class="form-control" id="number" placeholder="输入数量" name="goodsNumber">
                                                            </div>
                                <div class="modal-footer">
                                    <button type="submit" class="btn btn-primary">确定</button>
                                </div>
                            </form>

                        </div>

                    </div>

                </div>
            </div>

        </div>
    </div>
</div>

<script>

    $(function() {

        $('#login-modal').modal({
            show: false,
            backdrop: false,
            remote: 'XiuGai.html'
        });
    });
</script>


</body>
</html>